function send_event_handler( evt ) {
  var msgcomposeWindow = document.getElementById( "msgcomposeWindow" );
  var msg_type = msgcomposeWindow.getAttribute( "msgtype" );

  // do not continue unless this is an actual send event
  if( !(msg_type == nsIMsgCompDeliverMode.Now || msg_type == nsIMsgCompDeliverMode.Later) )
    return;

  // alter other composition fields/headers
//  if( gMsgCompose.compFields.otherRandomHeaders != "" )
//    gMsgCompose.compFields.otherRandomHeaders += "\n";
  gMsgCompose.compFields.otherRandomHeaders += "X-Mozilla-Keys: answer_wait\n";
}

// could use document.getElementById("msgcomposeWindow") instead of window
window.addEventListener( "compose-send-message", send_event_handler, true );
